import uuid
import datetime
from sqlalchemy import Column, Integer, String, Float, ForeignKey, DateTime, Date
from sqlalchemy.orm import declarative_base
from sqlalchemy.dialects.postgresql import UUID, BOOLEAN

Base = declarative_base()

class mAccount(Base):
    __tablename__ = 'accounts'
    __table_args__ = {'schema': 'app_accounts'}

    #id = Column(Integer, primary_key=True)
    id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    account_number = Column(String)
    cust_id = Column(UUID(as_uuid=True))
    currency = Column(String)
    amount = Column(Float)
    interest_rate = Column(Float)
    duration_months = Column(Integer)
    description = Column(String)
    open_date = Column(Date, default = datetime.datetime.now().date())
    end_date = Column(Date)
    created_at = Column(DateTime, default = datetime.datetime.now)
    updated_at = Column(DateTime, onupdate = datetime.datetime.now)
    is_active = Column(BOOLEAN, default=True)

'''
class mCustomer(Base):
    __tablename__ = 'customers'
    __table_args__ = {'schema': 'app_accounts'}

    #id = Column(Integer, primary_key=True)
    id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
    name = Column(String)
    surname = Column(String)
    email = Column(String)
    passport = Column(String)
    phone = Column(String)
    pwd = Column(String)
    created_at = Column(DateTime, default = datetime.datetime.now)
    updated_at = Column(DateTime, onupdate = datetime.datetime.now)
    is_active = Column(BOOLEAN, default=True)

class Post(Base):
    __tablename__ = 'posts'

    id = Column(Integer, primary_key=True)
    title = Column(String)
    content = Column(String)
    user_id = Column(Integer, ForeignKey('users.id'))
'''